package com.burstly.lib;

import android.content.Context;
import android.webkit.WebSettings;
import android.webkit.WebSettings.RenderPriority;
import android.webkit.WebView;
import com.burstly.lib.cache.CacheManager;
import com.burstly.lib.component.AdaptorFactoryCache;
import com.burstly.lib.constants.BurstlyProperties;
import com.burstly.lib.constants.Constants;
import com.burstly.lib.downloadtracker.DownloadTrackingManager;
import com.burstly.lib.exception.BurstlySdkNotInitializedException;
import com.burstly.lib.exception.UiExceptionHandlerManager;
import com.burstly.lib.exception.WrongThreadException;
import com.burstly.lib.feature.FeatureFactory;
import com.burstly.lib.feature.dtracker.IDownloadTracker;
import com.burstly.lib.network.beans.cookie.CookieManager;
import com.burstly.lib.network.request.AbortableAsyncTask;
import com.burstly.lib.network.request.RequestManager;
import com.burstly.lib.service.HostsProviderManager;
import com.burstly.lib.service.SdCardWatchingService;
import com.burstly.lib.service.ServerConfigurationService;
import com.burstly.lib.util.LoggerExt;
import com.burstly.lib.util.ManifestValidator;
import com.burstly.lib.util.Utils;

public class BurstlySdk
{
  private static final String NOT_INITIALIZED_MESSAGE = "Call BurstlySdk.init(context) method first!";
  private static final String TAG = "BurstlySdk";
  private static volatile boolean sIsInitialized;
  private static LoggerExt sLog;

  public static String getSdkVersion()
    throws BurstlySdkNotInitializedException
  {
    if (sIsInitialized)
      return Constants.SDK_VERSION;
    throw new BurstlySdkNotInitializedException("Call BurstlySdk.init(context) method first!");
  }

  public static void init(Context paramContext)
    throws WrongThreadException
  {
    sIsInitialized = true;
    Context localContext = paramContext.getApplicationContext();
    BurstlyProperties.initProperties(localContext);
    FeatureFactory.init(localContext);
    if (sLog == null)
      sLog = LoggerExt.getInstance();
    Utils.getUserAgentString(localContext);
    ManifestValidator.validate(localContext);
    Utils.initCCSString(localContext);
    Utils.setApplicationContext(localContext);
    UiExceptionHandlerManager.init();
    RequestManager.initRquestManager(localContext);
    HostsProviderManager.init(localContext);
    CookieManager.initCookieManager(localContext);
    setWebViewRedneringPriority(WebSettings.RenderPriority.LOW);
    Constants.getInstance();
    Utils.checkIsUiThread();
    IDownloadTracker localIDownloadTracker = FeatureFactory.getDTrackFeature();
    if (localIDownloadTracker != null)
      localIDownloadTracker.sendDTRequestIfNeeded(localContext);
    sLog.logDebug("BurstlySdk", "Burstly SDK was successfully initilaized.", new Object[0]);
  }

  public static void setWebViewRedneringPriority(WebSettings.RenderPriority paramRenderPriority)
    throws BurstlySdkNotInitializedException
  {
    if (sIsInitialized)
    {
      new WebView(Utils.getApplicationContext()).getSettings().setRenderPriority(paramRenderPriority);
      return;
    }
    throw new BurstlySdkNotInitializedException("Call BurstlySdk.init(context) method first!");
  }

  public static void shutdown(Context paramContext)
    throws WrongThreadException
  {
    Utils.checkIsUiThread();
    RequestManager.shutdown(paramContext);
    UiExceptionHandlerManager.cleanUp();
    SdCardWatchingService.stopWatching();
    AbortableAsyncTask.abortAllRequests("IP list request");
    AbortableAsyncTask.abortAllRequests(DownloadTrackingManager.TAG);
    ServerConfigurationService.shutdown();
    CacheManager.releaseCaches();
    AdaptorFactoryCache.destroy();
  }

  public static boolean wasInit()
  {
    return sIsInitialized;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.burstly.lib.BurstlySdk
 * JD-Core Version:    0.6.2
 */